<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>




    <style type="text/css">


        html, body, div, span, img, strong, sub, sup, tt, dd, dl, dt, form, label, table, caption, tbody, tfoot, thead, tr, th, td, ul, li, p, a {
            margin: 0;
            padding: 0;
        }

        .logo_box {
            width: 1000px;
            margin: 0 auto;
        }



        .text {
            width: 210px;
            height: 25px;
            outline: none;
            border: 0px;
            background: none;
            font-family: "微软雅黑", "黑体", "宋体";
            color: #000;
            font-size: 14px;
            line-height: 25px;
        }

        .yfm_box {
            width: 270px;
            height: 54px;

        }

        .mm_box {
            width: 270px;
            height: 54px;

        }

        .btn1 {
            width: 98px;
            height: 35px;
            background: #9CCD50;
            line-height: 35px;
            color: #333;
            font-family: "微软雅黑", "黑体", "宋体";
            font-size: 18px;
            text-align: center;
            border: 0px;
            border-radius: 8px;
            -moz-border-radius: 8px; /* Old Firefox */
            cursor: pointer;
            margin: 0 auto;
        }

        .btn1:hover {
            background-color: #BDE480;
        }

        .copyright {
            font-family: "微软雅黑", "黑体", "宋体";
            font-size: 12px;
            line-height: 25px;
            color: #7E612A;
            text-align: center;
        }
    </style>
</head>

<body>
<div class="logo_box">

    <div style="height:35px;"></div>
    <!--登录口-->
    <form id="loginForm" action="/doLogin" method="post">
        <div style="width:270px; height:200px; padding-left:15px; margin:0 auto;">
            <div class="yfm_box">
                <div style="height:15px;"></div>
                <div style="padding-left:42px;"><input id="username" name="username" type="text" class="text"/></div>
            </div>
            <div style="height:5px;"></div>
            <div class="mm_box">
                <div style="height:15px;"></div>
                <div style="padding-left:42px;"><input id="password" name="password" type="password" class="text"/></div>
            </div>
            <div style="height:20px;"></div>
            <div class="btn1" id="loginBtn">登录</div>
        </div>
    </form>
    <div style="height:500px;"></div>
    <div class="copyright">Copyright©2018 四川国恒泰信息有限公司 版权所有</div>
</div>
<script type="text/javascript">


    function checkUser() {
        var username = $("#username").val();
        var password = $("#password").val();
        if (username == '') {
            layer.msg('用户名为空', function () {
            });
            $("#username").focus();
            return;
        }

        if(password == '') {
            layer.msg('密码为空', function () {
            });
            $("#password").focus();
            return;
        }

        console.log(contextRoot);
        $.ajax({
            url:contextRoot+'checkUser',
            type:'POST',
            async:true,
            data:{
                username:username,password:password
            },
            dataType:'text',
            success:function(data){
                if(data == '') {
                    $("#loginForm").submit();
                } else {
                    layer.msg(data, function () {
                    });
                }
            },
            error:function(xhr,textStatus){
                console.log('错误')
                console.log(xhr)
                console.log(textStatus)
            }
        })
    }
</script>
</body>
</html>
